<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ include file="../../common/inc.jsp" %>
<%@ include file="../../common/loading.jsp" %>
<%
request.setCharacterEncoding("UTF-8");
String now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
ChannelInfoDao clDao = new ChannelInfoDao();
LanguageInfoDao lgDao = new LanguageInfoDao();
BusinessInfoDao biDao = new BusinessInfoDao();
String message = "" ;
//获取所有语种
List<LanguageInfo> languageInfoList = lgDao.getAll();
//获取六大业务
List<ChannelInfo> channelInfoAllList = clDao.getSubListByParentIdLanguageId(1,2,0,1000);

//获取操作表示符号
String cate = request.getParameter("cate");

int languageId = StringUtils.isNotBlank(request.getParameter("languageId")) ? Integer.parseInt(request.getParameter("languageId")) : 0 ;
int channelId = StringUtils.isNotBlank(request.getParameter("channelId")) ? Integer.parseInt(request.getParameter("channelId")) : 0 ;

int curPage = StringUtils.isNotBlank(request.getParameter("curPage")) ? Integer.parseInt(request.getParameter("curPage")) : 0 ;
PageBean pageBean = new PageBean(curPage,0);
List<BusinessInfo> biList = biDao.getSubList(languageId,channelId,pageBean.getStart(),pageBean.getRowsPerPage());
pageBean.setMaxRowCount(biDao.getCount(languageId,channelId));
pageBean.setMaxPage();
pageBean.setPageNoList();

Map<Integer,String> channelMap = clDao.getAllChannelAsMap();
Map<Integer,String> languageMap = lgDao.getLanuageMap();

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
	<title>业务概况--管理</title>
	<META http-equiv="content-type" content="text/html; charset=UTF-8">
	<LINK href="../../styleAdmin/css/portalinabox.css" type="text/css" rel="stylesheet">		
	<meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
   <meta http-equiv="expires" content="0">
	<script type="text/javascript" src="../../styleAdmin/js/prototype-1.6.0.3.js"></script>
	<script type="text/javascript">
		function edit(id){
			window.location = 'edit.jsp?cate=showUpdate&biId='+id;
		}
		function del(id){
			if(!confirm('删除文章后，文章将暂时放入垃圾箱中! \r\n\r\n                确认删除')) return;
			window.location = 'delete.jsp?biId='+id;
		}
		function doQuery(){
			document.myform.jsp = "list.jsp";
			document.myform.submit();
		}
</script>
</HEAD>
<body bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0">
<form action="" method="get" name="myform">
<%@include file="../common/navigate.jsp" %>
<table width="96%" border="0" align="center" cellpadding="0" style="margin-top:5px;" cellspacing="0">
	<tr>
		<td valign="top">
			<!-- 搜索栏 -->
			<table width="100%" border="1" class="mainFunctionTable"  cellpadding="0" cellspacing="1">
				<tr height="25" class="pLabel">
			   		<td class="td_nwarpstyle">&nbsp;&nbsp;业务概况描述--管理</td>
			 	</tr>
				<tr>
			   		<td width="100%" height="25">
			   			<table width="100%" border="0" cellspacing="1">
			     			<tr>
			       				<td>&nbsp;&nbsp;
									所属语种&nbsp;&nbsp;<select name="languageId" id="languageId">
				         				<option value="0">请选择</option>
											<%for(LanguageInfo lgSel : languageInfoList){ %>
												<option value="<%=lgSel.getId()%>" <%=lgSel.getId() == languageId ? "selected" : "" %>><%=lgSel.getName() %></option>
											<%} %>
			         				</select>
									所属栏目&nbsp;&nbsp;<select name="channelId" id="channelId">
				         				<option value="0">请选择</option>
											<%for(ChannelInfo clSel : channelInfoAllList){ %>
												<option value="<%=clSel.getChannelId()%>" <%=clSel.getChannelId() == channelId ? "selected" : "" %>><%=clSel.getChannelName() %></option>
											<%} %>
			         				</select>
			       				</td>
			       				<td>
			       					<a href="javascript:doQuery();"><img src="../../styleAdmin/images/button/query.gif" border="0"/></a>
			       					&nbsp;&nbsp;&nbsp;&nbsp;<a href="insert.jsp?cate=showIn" id="lnkAdd"><img src="../../styleAdmin/images/button/addNew.gif" border="0"></a>
			        			</td>
			     			</tr>
			    		</table>
			    	</td>
			   </tr>
			 </table>
		  </td>
	  </tr>
	  <tr>
	    <td>
			<table width=100% border=1 class="mainFunctionTable"  cellpadding="0" cellspacing="1" id="table_channel">
				<tr height=25 class="pLabel" align="center">
					<td width="5%" class="td_nwarpstyle">标识</td>
					<td width="15%" class="td_nwarpstyle">语种</td>
					<td width="15%" class="td_nwarpstyle">栏目</td>
					<td width="10%" class="td_nwarpstyle" align="center">操作</td>
				</tr>
			</table>
			<table width=100% border=1 class="mainFunctionTable"  cellpadding="0" cellspacing="1" id="table_channel">
				<%boolean flag = false ;for(BusinessInfo nInfo : biList){%>
					<tr class="<%=flag ? "c2" : "c1" %>">
						<td width="5%"   height="25" align="center"><input type="checkbox" name="newsId" value="<%=nInfo.getBiId()%>/>"/></td>
						<td width="15%"><%=languageMap.get(nInfo.getLanguageId())%></td>
						<td width="15%"><%=channelMap.get(nInfo.getChannelId())%></td>
						<td width="10%" align=center>
							<a href="javascript:edit(<%=nInfo.getBiId()%>);"><img src="../../styleAdmin/images/edit.gif" border="0" title="编辑"/></a>
							&nbsp;&nbsp;
							<a href="javascript:del(<%=nInfo.getBiId()%>);"><img src="../../styleAdmin/images/delete.gif" border="0" title="删除"/></a>
						</td>
					</tr>
				<%flag = !flag ;} %>
	  		</table>
		 </td>
	   </tr>
	   <tr>
		   <td height=25>
			<%String pageURL = "list.jsp?languageId=" + languageId  + "&channelId=" + channelId + "&curPage="; %>
			<%@include file="../common/page.jsp"%>
		  </td>
	  </tr>
</table>
</form>
</body>
</HTML>